package cn.sun.user.controller;

import cn.sun.basic.util.AjaxResult;
import cn.sun.user.service.IVerifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/verifycode")
public class VerifyCodeController {
    @Autowired
    private IVerifyService verifyService;

    /**
     * 发送短信接口
     * @param param
     * @return
     */
    @PostMapping("/smsCode")
    public AjaxResult sendVerifyCode(@RequestBody Map<String,String> param){

        try {
            verifyService.sendVerifyCode(param);
            return AjaxResult.me();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.me().setMessage("发送失败，请重新发送！");
        }
    }
}
